import com.googlecode.lightest.studio.Test

class TestTests extends GroovyTestCase {

    @Override
    void setUp() {
        Test.list()*.delete()
    }
    
    void testPersist() {
        new Test(name: 'baz', className: 'foo.Bar', description: 'qux').save()
        
        def tests = Test.findAllByClassName('foo.Bar')
        
        assertEquals(1, Test.count())
        assertEquals(1, tests.size())
        assertEquals('baz', tests[0].name)
    }
    
    void testToString() {
        def test = new Test(name: 'baz', className: 'foo.Bar')
        
        assertEquals("baz [foo.Bar]", test.toString())
    }

    void testEquals() {
        assertEquals(new Test(name: 'foo', className: 'bar'), new Test(name: 'foo', className: 'bar'))
    }
}
